package com.eonmind.user.provider;

import com.eonmind.common.contract.data.response.ResponseEntity;
import com.eonmind.common.provider.entity.user.User;
import com.eonmind.user.contract.api.UserFeignService;
import com.eonmind.user.contract.dto.UserInfoData;
import com.eonmind.user.mapper.UserMapper;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class UserFeignProvider implements UserFeignService {
    @Resource
    private UserMapper userMapper;
    @Override
    public ResponseEntity<UserInfoData> queryUserInfoById(Long userId) {
        UserInfoData userInfoData = new UserInfoData();
        User user = userMapper.selectUserById(userId);
        BeanUtils.copyProperties(user, userInfoData);
        return ResponseEntity.success(userInfoData);
    }
}
